home *** CD-ROM | disk | FTP | other *** search
/ Resource Library: Multimedia / Resource Library: Multimedia.iso / maestro / source / videofrm / xvideo.c < prev   
Encoding:
C/C++ Source or Header  |  1993-06-15  |  7.0 KB  |  191 lines

  1. /*
  2.  * Copyright (c) 1992 Stanford University
  3.  *
  4.  * Permission to use, copy, modify, and distribute this software and 
  5.  * its documentation for any purpose is hereby granted without fee, provided
  6.  * that (i) the above copyright notices and this permission notice appear in
  7.  * all copies of the software and related documentation, and (ii) the name
  8.  * Stanford may not be used in any advertising or publicity relating to
  9.  * the software without the specific, prior written permission of
  10.  * Stanford.
  11.  * 
  12.  * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, 
  13.  * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY 
  14.  * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.  
  15.  *
  16.  * IN NO EVENT SHALL STANFORD BE LIABLE FOR ANY SPECIAL, INCIDENTAL,
  17.  * INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, OR ANY DAMAGES
  18.  * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER OR NOT
  19.  * ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF LIABILITY,
  20.  * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
  21.  * SOFTWARE.
  22.  */
  23.  
  24. /* $Header: /Source/Media/drapeau/VideoFrame/RCS/xvideo.c,v 1.1 92/07/14 14:36:22 drapeau Exp $ */
  25. /* $Log:    xvideo.c,v $
  26.  * Revision 1.1  92/07/14  14:36:22  drapeau
  27.  * Initial revision
  28.  *  */
  29.  
  30. #include "VideoFrame.h"
  31.  
  32. static char xvideoRcsid[] = "$Header: /Source/Media/drapeau/VideoFrame/RCS/xvideo.c,v 1.1 92/07/14 14:36:22 drapeau Exp $";
  33.  
  34.  
  35. void InitXVideoCanvases()
  36. {
  37.   Rect    tempRect;
  38.   int    tempValue;
  39.   
  40.   videoIn1 = xv_create(VideoFrame_inputWindow1->inputWindow1,        /* Try to create the first XVideo input object */
  41.                VIDEO_IN,
  42.                VIDEO_CHANNEL, VIDEO_IN_ONE,
  43.                VIDEO_LIVE, TRUE,
  44.                VIDEO_SQUEEZE, TRUE,
  45.                XV_X, 0,
  46.                NULL);
  47.   if (videoIn1 == (VideoIn)NULL)                    /* Did initialization fail? */
  48.   {                                    /* Yes, determine why and print the error message */
  49.     if (Xv_VideoStatus == VIDEO_CHANNEL_IN_USE)
  50.     {
  51.       fprintf(stderr,"Channel 1 is already in use.\n");
  52.     }
  53.     else if (Xv_VideoStatus == VIDEO_NO_MORE_CHANNELS)
  54.     {
  55.       fprintf(stderr,"Requested channel is not available.\n");
  56.     }
  57.     else
  58.     {
  59.       fprintf(stderr,"Could not initialize Video Input 1.\n");
  60.     }
  61.     xv_set(VideoFrame_mainWindow->input1ShownChoice, PANEL_VALUE, 1, NULL);
  62.     currentSelection.input1.shown = False;
  63.   }
  64.   else                                    /* Intitialization succeeded; get initial values */
  65.   {
  66.     frame_get_rect(VideoFrame_inputWindow1->inputWindow1, &tempRect); /* Get the size of the 1st video input window */
  67.     currentSelection.input1.x = tempRect.r_left;
  68.     currentSelection.input1.y = tempRect.r_top;
  69.     currentSelection.input1.width = tempRect.r_width;
  70.     currentSelection.input1.height = tempRect.r_height;
  71.     
  72.     xv_set(VideoFrame_mainWindow->input1ShownChoice, PANEL_VALUE, 0, NULL);
  73.     currentSelection.input1.shown = True;
  74.     if (xv_get(videoIn1, VIDEO_SQUEEZE) == TRUE)
  75.     {
  76.       currentSelection.input1.cropped = False;
  77.       xv_set(VideoFrame_mainWindow->input1CroppedChoice, PANEL_VALUE, 1, NULL);
  78.     }
  79.     else
  80.     {
  81.       currentSelection.input1.cropped = True;
  82.       xv_set(VideoFrame_mainWindow->input1CroppedChoice, PANEL_VALUE, 0, NULL);
  83.     }
  84.     if (xv_get(videoIn1, VIDEO_NORMAL_ASPECT) == FALSE)
  85.     {
  86.       currentSelection.input1.aspectRatio = Any;
  87.       xv_set(VideoFrame_mainWindow->input1AspectChoice, PANEL_VALUE, 0, NULL);
  88.     }
  89.     else
  90.     {
  91.       currentSelection.input1.aspectRatio = Fixed;
  92.       xv_set(VideoFrame_mainWindow->input1AspectChoice, PANEL_VALUE, 1, NULL);
  93.     }
  94.  
  95.     tempValue = xv_get(videoIn1, VIDEO_BRIGHTNESS);
  96.     xv_set(VideoFrame_mainWindow->input1BrightSlider,
  97.        PANEL_VALUE, tempValue, NULL);
  98.     currentSelection.input1.brightness = tempValue;
  99.  
  100.     tempValue = xv_get(videoIn1, VIDEO_CONTRAST);
  101.     xv_set(VideoFrame_mainWindow->input1ContrastSlider,
  102.        PANEL_VALUE, tempValue, NULL);
  103.     currentSelection.input1.contrast = tempValue;
  104.  
  105.     tempValue = xv_get(videoIn1, VIDEO_SATURATION);
  106.     xv_set(VideoFrame_mainWindow->input1SaturationSlider,
  107.        PANEL_VALUE, tempValue, NULL);
  108.     currentSelection.input1.saturation = tempValue;
  109.     
  110.     tempValue = xv_get(videoIn1, VIDEO_HUE);
  111.     xv_set(VideoFrame_mainWindow->input1HueSlider,
  112.        PANEL_VALUE, tempValue, NULL);
  113.     currentSelection.input1.hue = tempValue;
  114.   }
  115.   videoIn2 = xv_create(VideoFrame_inputWindow2->inputWindow2,        /* Try to create the second XVideo input object */
  116.                VIDEO_IN,
  117.                VIDEO_CHANNEL, VIDEO_IN_TWO,
  118.                VIDEO_LIVE, TRUE,
  119.                VIDEO_SQUEEZE, TRUE,
  120.                XV_X, 0,
  121.                NULL);
  122.   if (videoIn2 == (VideoIn)NULL)                    /* Did initialization fail? */
  123.   {                                    /* Yes, determine why and print the error message */
  124.     if (Xv_VideoStatus == VIDEO_CHANNEL_IN_USE)
  125.     {
  126.       fprintf(stderr,"Channel 2 is already in use.\n");
  127.     }
  128.     else if (Xv_VideoStatus == VIDEO_NO_MORE_CHANNELS)
  129.     {
  130.       fprintf(stderr,"Requested channel is not available.\n");
  131.     }
  132.     else
  133.     {
  134.       fprintf(stderr,"Could not initialize Video Input 2.\n");
  135.     }
  136.     xv_set(VideoFrame_mainWindow->input2ShownChoice, PANEL_VALUE, 1, NULL);
  137.   }
  138.   else                                    /* Intitialization succeeded; get initial values */
  139.   {
  140.     frame_get_rect(VideoFrame_inputWindow2->inputWindow2, &tempRect); /* Get the size of the 2nd video input window */
  141.     currentSelection.input2.x = tempRect.r_left;
  142.     currentSelection.input2.y = tempRect.r_top;
  143.     currentSelection.input2.width = tempRect.r_width;
  144.     currentSelection.input2.height = tempRect.r_height;
  145.     
  146.     xv_set(VideoFrame_mainWindow->input2ShownChoice, PANEL_VALUE, 0, NULL);
  147.     currentSelection.input2.shown = True;
  148.     if (xv_get(videoIn2, VIDEO_SQUEEZE) == TRUE)
  149.     {
  150.       currentSelection.input2.cropped = False;
  151.       xv_set(VideoFrame_mainWindow->input2CroppedChoice, PANEL_VALUE, 1, NULL);
  152.     }
  153.     else
  154.     {
  155.       currentSelection.input2.cropped = True;
  156.       xv_set(VideoFrame_mainWindow->input2CroppedChoice, PANEL_VALUE, 0, NULL);
  157.     }
  158.     if (xv_get(videoIn2, VIDEO_NORMAL_ASPECT) == FALSE)
  159.     {
  160.       currentSelection.input2.aspectRatio = Any;
  161.       xv_set(VideoFrame_mainWindow->input2AspectChoice, PANEL_VALUE, 0, NULL);
  162.     }
  163.     else
  164.     {
  165.       currentSelection.input2.aspectRatio = Fixed;
  166.       xv_set(VideoFrame_mainWindow->input2AspectChoice, PANEL_VALUE, 1, NULL);
  167.     }
  168.  
  169.     tempValue = xv_get(videoIn2, VIDEO_BRIGHTNESS);
  170.     xv_set(VideoFrame_mainWindow->input2BrightSlider,
  171.        PANEL_VALUE, tempValue, NULL);
  172.     currentSelection.input2.brightness = tempValue;
  173.  
  174.     tempValue = xv_get(videoIn2, VIDEO_CONTRAST);
  175.     xv_set(VideoFrame_mainWindow->input2ContrastSlider,
  176.        PANEL_VALUE, tempValue, NULL);
  177.     currentSelection.input2.contrast = tempValue;
  178.  
  179.     tempValue = xv_get(videoIn2, VIDEO_SATURATION);
  180.     xv_set(VideoFrame_mainWindow->input2SaturationSlider,
  181.        PANEL_VALUE, tempValue, NULL);
  182.     currentSelection.input2.saturation = tempValue;
  183.     
  184.     tempValue = xv_get(videoIn2, VIDEO_HUE);
  185.     xv_set(VideoFrame_mainWindow->input2HueSlider,
  186.        PANEL_VALUE, tempValue, NULL);
  187.     currentSelection.input2.hue = tempValue;
  188.   }
  189.   return;
  190. }                                    /* end function InitXVideoCanvases */
  191.